package apiday05homework;

import java.io.BufferedOutputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;

public class FlushDemo {
    public static void main(String[] args) throws IOException {
        /*
        FileOutputStream fos = new FileOutputStream("bos1.txt", true);
        BufferedOutputStream bos = new BufferedOutputStream(fos);

        String str = "我们的爱";
        byte[] data = str.getBytes(StandardCharsets.UTF_8);
        bos.write(data);
        bos.flush();
        System.out.println("数据写出完毕");

         */
        FileOutputStream fos = new FileOutputStream("bos1.txt", true);
        BufferedOutputStream bos = new BufferedOutputStream(fos);
        String str = "阳光彩虹小白马";
        byte[] data = str.getBytes(StandardCharsets.UTF_8);
        bos.write(data);
        System.out.println("数据写出完毕");
        bos.flush();
    }
}
